import { postService, postServiceList } from '.'
import { PORT1 } from '../config/net.config'
import { Inventory } from './interface/goods'
import { Information } from './interface/information'

// 获取商品分类列表
export const getWaresCategoryListAPI = (params: {}) => {
  return postService<Array<Inventory.CategoryList>>(`${PORT1}/CoreCmsGoodsCategory/GetPageList`, params, 'form')
}
export const createWaresCategoryList = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsGoodsCategory/DoCreate`, params, 'json')
}
export const editWaresCategoryList = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsGoodsCategory/DoEdit`, params)
}
export const deleteWaresCategoryList = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsGoodsCategory/DoBatchDelete`, params)
}

export const getGoodsList = (params: any) => {
  return postServiceList<Inventory.ResGoodsList>(`${PORT1}/CoreCmsGoods/GetGoodProcuctPageList`, params, false)
}
export const deleteGoodsAPI = (params: any) => {
  return postService<null>(`${PORT1}/CoreCmsGoods/DoBatchDelete`, params, 'json')
}
export const addGoodsAPI = (params: Inventory.GoodsDetail) => {
  return postService<null>(`${PORT1}/CoreCmsGoods/DoCreate`, params, 'json')
}

// 获取商品详细
export const getGoodsDetailAPI = (params: any) => {
  return postService<Inventory.GoodsDetail>(`${PORT1}/CoreCmsGoods/GetEdit`, params, 'json')
}

// 编辑商品
export const editGoodsAPI = (params: Inventory.GoodsDetail) => {
  return postService<null>(`${PORT1}/CoreCmsGoods/DoEdit`, params, 'json')
}

// 获取品牌列表
export const getBranchAPI = (params: {}) => {
  return postServiceList<Inventory.BranchList>(`${PORT1}/corecmsbrand/GetPageList`, params, false)
}
// 新增商品品牌
export const addBrandAPI = (params: {}) => {
  return postService(`${PORT1}/CoreCmsBrand/DoCreate`, params, 'json')
}

// 编辑商品品牌
export const editBrandAPI = (params: {}) => {
  return postService(`${PORT1}/CoreCmsBrand/DoEdit`, params, 'json')
}

// 删除商品品牌
export const deleteBrandAPI = (params: { id: string }) => {
  return postService(`${PORT1}/CoreCmsBrand/DoBatchDelete`, params, 'json')
}

// 切换品牌显示状态
export const changeBrandShowAPI = (params: { id: string; data: boolean }) => {
  return postService(`${PORT1}/CoreCmsBrand/DoSetisShow`, params, 'json')
}

// 获取供应商列表
export const getSupplierAPI = (params: {}) => {
  return postServiceList<Inventory.SupplierList>(`${PORT1}/CoreCmsSupplier/GetPageList`, params, false)
}

// 新增供应商
export const createSupplierAPI = (params: {}) => {
  return postService(`${PORT1}/CoreCmsSupplier/DoCreate`, params, 'json')
}

// 编辑供应商
export const editSupplierAPI = (params: {}) => {
  return postService(`${PORT1}/CoreCmsSupplier/DoEdit`, params, 'json')
}

// 删除供应商
export const deleteSupplierAPI = (params: {}) => {
  return postService(`${PORT1}/CoreCmsSupplier/DoDelete`, params, 'json')
}
export const deleteAllSupplierAPI = (params: {}) => {
  return postService(`${PORT1}/CoreCmsSupplier/DoBatchDelete`, params, 'json')
}

// 获取供应商区域列表
export const getSupplierAreaAPI = (params: {}) => {
  return postServiceList<Information.SupplierAreaList>(`${PORT1}/CoreCmsSupplierRegion/GetPageList`, params, false)
}

// 新增供应商区域
export const createSupplierAreaAPI = (params: {}) => {
  return postService(`${PORT1}/CoreCmsSupplierRegion/DoCreate`, params, 'json')
}

// 编辑供应商区域
export const editSupplierAreaAPI = (params: {}) => {
  return postService(`${PORT1}/CoreCmsSupplierRegion/DoEdit`, params, 'json')
}

// 删除供应商区域
export const deleteSupplierAreaAPI = (params: {}) => {
  return postService(`${PORT1}/CoreCmsSupplierRegion/DoDelete`, params, 'json')
}
export const deleteAllSupplierAreaAPI = (params: {}) => {
  return postService(`${PORT1}/CoreCmsSupplierRegion/DoBatchDelete`, params, 'json')
}
